xmlhttp_trucker = null;
function truckerChange()
{
xmlhttp_trucker=GetXmlHttpObject();
if (xmlhttp_trucker==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
var trucker_id = document.getElementById('sel_trucker').value;
var url="ajax_trucker_drop.php";
url=url+"?trucker="+trucker_id;
xmlhttp_trucker.onreadystatechange=scTrucker;
xmlhttp_trucker.open("GET",url,true);
xmlhttp_trucker.send(null);
}


function scTrucker()
{
if (xmlhttp_trucker.readyState==4)
  {
  var my_array = eval(xmlhttp_trucker.responseText);
  var cmbObj = document.getElementById('sel_equip_size')
  cmbObj.length = 0;
  
  var row;
  for (row = 0; row < my_array.length; row++)
  {
	var size = my_array[row][0];
	var sel_value = my_array[row][1];
	var x = document.createElement('option');
	
	x.text = size;
	x.value = sel_value;
	try
	{
		cmbObj.add(x,null); // standards compliant
	}
	catch(ex)
	{
	cmbObj.add(x); // IE only
	}
  }
  populateEquipType();
  }
}

function populateEquipType()
{
xmlhttp_trucker=GetXmlHttpObject();
if (xmlhttp_trucker==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
var trucker_id = document.getElementById('sel_trucker').value;
var url="ajax_trucker_drop2.php";
url=url+"?trucker="+trucker_id;
xmlhttp_trucker.onreadystatechange=scType;
xmlhttp_trucker.open("GET",url,true);
xmlhttp_trucker.send(null);
}

function scType()
{
if (xmlhttp_trucker.readyState==4)
  {
  var my_array = eval(xmlhttp_trucker.responseText);
  var cmbObj = document.getElementById('sel_equip_type')
  cmbObj.length = 0;
  
  var row;
  for (row = 0; row < my_array.length; row++)
  {
	var type = my_array[row][0];
	var sel_value = my_array[row][1];
	var x = document.createElement('option');
	
	x.text = type;
	x.value = sel_value;
	try
	{
		cmbObj.add(x,null); // standards compliant
	}
	catch(ex)
	{
	cmbObj.add(x); // IE only
	}
  }
  checkAvailTrucks();
  }
}


function checkAvailTrucks()
{
xmlhttp_trucker=GetXmlHttpObject();
if (xmlhttp_trucker==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
var trucker_id = document.getElementById('sel_trucker').value;
var size = document.getElementById('sel_equip_size').value;
var type = document.getElementById('sel_equip_type').value;
var url="ajax_avail_trucks.php";
url=url+"?trucker="+trucker_id;
url=url+"&size="+size;
url=url+"&type="+type;
xmlhttp_trucker.onreadystatechange=scTrucks;
xmlhttp_trucker.open("GET",url,true);
xmlhttp_trucker.send(null);
}

function scTrucks()
{
  if (xmlhttp_trucker.readyState==4)
  {
  var my_array = eval(xmlhttp_trucker.responseText);
  var cmbObj = document.getElementById('sel_truck');
  cmbObj.length = 0;
  
  var row;
  for (row = 0; row < my_array.length; row++)
  {
	var type = my_array[row][0];
	var sel_value = my_array[row][1];
	var x = document.createElement('option');
	
	x.text = type;
	x.value = sel_value;
	try
	{
		cmbObj.add(x,null); // standards compliant
	}
	catch(ex)
	{
	cmbObj.add(x); // IE only
	}
  }
  }
}